package provider

import (
	"context"
	_ "dubbo.apache.org/dubbo-go/v3/imports" // dubbogo 框架依赖，所有dubbogo进程都需要隐式引入一次
	hessian2_iface "gitee.com/youbeiwuhuan/dubbo-go-proj/hessian2-example/hessian2-iface"
	"google.golang.org/appengine/log"
	"time"
)

type UserProvider struct {
}

// GetUser 实现接口方法
func (u *UserProvider) GetUser(ctx context.Context, req int64) (*hessian2_iface.User, error) {
	log.Infof(context.Background(), "req:%#v", req)
	user := &hessian2_iface.User{}
	user.Id = req
	user.Name = "laurence-go"
	user.Age = 22
	user.Time = time.Now()
	return user, nil
}

//// MethodMapper 定义方法名映射，从 Go 的方法名映射到 Java 小写方法名，只有 dubbo 协议服务接口才需要使用
//// go -> go 互通无需使用
//func (s *UserProvider) MethodMapper() map[string]string {
//	return map[string]string{
//		"GetUser": "getUser",
//	}
//}
